/**
 * 文件流导出文件
 * @param data
 * @param filename
 */
export default function downloadFile (data: Blob, filename: string) {
  const url = window.URL.createObjectURL(new Blob([data]))

  const link = document.createElement('a')
  link.href = url

  link.setAttribute('download', filename)

  document.body.appendChild(link)
  link.click()

  window.URL.revokeObjectURL(url)
  document.body.removeChild(link)
}
